package com.example.junitdemo.iostream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

public class FileStreamDemo {
    public static void main(String[] args) {
        String NAV = "ABC";
        try {
            FileInputStream files  = new FileInputStream("E:\\springboot\\test163\\Stest163\\junitdemo\\src\\main\\resources\\yang.txt");

            InputStreamReader reader = new InputStreamReader(files,"utf-8");

            StringBuffer buf = new StringBuffer();
            while (reader.ready()){
                buf.append((char)reader.read());
            }

            System.out.println(buf);

            reader.close();
            files.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }


        String a = "hello2";
        String b = "hello"+"2";
        System.out.println((a == b));

        String a1 = "hello2";
        String b1 = "hello";
        String c = b + 2;
        System.out.println((a1 == c));

        String a2 = "hello2";
        final String b2 = "hello";
        String c2 = b2 + 2;
        System.out.println((a2 == c2));

        String a3 = "hello";
        String b3 =  new String("hello");
        String c3 =  new String("hello");
        String d3 = b3.intern();
        System.out.println("ceshi---------------->>");

        System.out.println(a3==b3);
        System.out.println(b3==c3);
        System.out.println(b3==d3);
        System.out.println(a3==d3);
    }
}
